//河段模型水库
Ext.define("Admin.view.sys.DdsMRsv", {
	extend: "Admin.common.container.BaseContainer",
	xtype: "ddsMRsv",
	alias: "ddsMRsv",
	requires: [
		"Ext.panel.Panel",
		"Ext.grid.Panel",
		"Ext.button.Button",
		"Admin.common.form.SearchFormPanel",
		"Admin.store.sys.DdsMRsv",
	],
	controller: "ddsMRsvController",
	layout: 'fit',
	width: '100%',
	height: 200,

	items: [
		{
			title: "河段模型水库",
			xtype: "baseGridPanel",
			reference: "riverMRGrid",
			border: true,
			columns: [
				// {
				// 	header: "河流", dataIndex: "river", align: "center", flex: 1, renderer: function (value, record) {
				// 		if (value == '02') {
				// 			return '抚河';
				// 		} else {
				// 			return '袁河';
				// 		}
				// 	}
				// },
				{
					header: "污染发生河段", dataIndex: "rcd", align: "center", flex: 1,
					 renderer: function (value, record) {
						return getRnm(value);
					}
				},
				{ header: "参与调度水库", dataIndex: "resnm", align: "center", flex: 1 },
				{ header: "水库编码", dataIndex: "rescd", align: "center", flex: 1 },
				{ header: "水库测站编码", dataIndex: "stcd", align: "center", flex: 1 },
				{ header: "水库测站名称", dataIndex: "stnm", align: "center", flex: 1 },
				{
					xtype: "actioncolumn",
					text: "操作",
					align: "center",
					width: 100,
					sortable: false,
					menuDisabled: true,
					items: [
						{
							iconCls: "x-fa fa-edit",
							tooltip: "编辑",
							handler: "riverUpdate"
						},
						{
							iconCls: "x-fa fa-times-circle",
							tooltip: "删除",
							handler: "riverDelete"
						}
					]
				}
			],
			store: {type:"ddsMRsv"},
			tbar: [
				{
					xtype: "searchFormPanel",
					columns: 2,
					items: [
						{
							xtype: "dicComboBox",
							dicType: 'riverRcd',
							maxWidth: 300,
							fieldLabel: "污染发生河段",
							labelWidth: 100,
							reference: 'serchRcd',
							listeners: {
								added:function(){
									var store = this.getStore();
									store.clearFilter();
									store.filter(
										{
											property : 'river',
											value    : config.RIVER
										}
									);
								}
							}
						},
					]
				},
				"->",
				{
					xtype: "button",
					iconCls: "x-fa fa-search",
					text: "查询",
					handler: "riverSearch"
				},
				{
					xtype: "button",
					iconCls: "x-fa fa-save",
					text: "新增",
					handler: "riverAdd"
				}
			],
			bbar: {
				xtype: "pagingtoolbar",
				autoLoad: true,
				displayInfo: true,
				displayMsg: "显示从第{0}条数据到第{1}条数据，共{2}条数据",
				emptyMsg: "没有记录"
			}
		},

	]
});

//专家库新增/修改的form表单
Ext.define("Admin.view.sys.RiverMRForm", {
	// extend: 'Ext.form.Panel',
	extend: "Admin.common.form.BaseFormPanel",
	xtype: "riverMRForm",
	alias: "riverMRForm",
	bodyPadding: 10,
	layout: "anchor",
	defaults: {
		anchor: "100%",
		labelWidth: 120,
		labelAlign: "right"
	},
	defaultType: "textfield",
	margin: "0 0 10 0",
	items: [
		{
			xtype: "combobox",
			fieldLabel: "污染发生河段",
			valueField: "rcd",
			displayField: "rnm",
			name: "rcd",
			disabled: false,
			emptyText: "请选择河段名称",
			reference: "riverRcd",
			listeners: {
				added: function (combo) {
					var _that = this;
					var store = Ext.create('Ext.data.Store', {
						fields: ['rnm','rcd'],
						data: mriverList
					});
					store.clearFilter();
					store.filter(
						{
							property : 'river',
							value    : config.RIVER
						}
					);
					combo.setStore(store);
				}
			}
		},
		{
			fieldLabel: "参与调度水库",
			name: "resnm",
			allowBlank: false,
			disabled: false
		},
		{
			fieldLabel: "水库编码",
			name: "rescd",
			allowBlank: false,
			disabled: false,
		},
		{
			fieldLabel: "水库测站编码",
			name: "stcd",
			allowBlank: false,
			disabled: false
		},
		{
			fieldLabel: "水库测站名称",
			name: "stnm",
			allowBlank: false,
			disabled: false
		}]
});
